dd <- c("C:/XunCao/Research/Portfolio/mcmc_net_polity/2001try 2") 
setwd(dd)

dat<-dget("data_wd_nomissing_polity2001")

Xs<-na.omit(dat[[3]])
Xs[, 4]<-log(Xs[, 4])
Xs[, 5]<-log(Xs[, 5])

Xr<-Xs



Yd<-dat[[1]][rownames(Xs), rownames(Xs)]
Yd[is.na(Yd)]<-0 # be consistent with Xd
diag(Yd)<-NA
Yd<-log(Yd+1)

Xd<-dat[[2]][rownames(Xs), rownames(Xs), -2] # need to change this 
#Xd[,,1][is.na(Xd[,,1])]<-0; Xd[,,1]<-log(Xd[,,1]+1) # need to change this 
#Xd[,,2][is.na(Xd[,,2])]<-0; Xd[,,2]<-log(Xd[,,2]+1) # exports logged


source("gbme.asym.r")
n<-dim(Yd)[1]
Y<-Yd

# call the main estimation package, gbme
gbme(Y=Yd,Xd=Xd,Xs=Xs,Xr=Xr,k=3,NS=100000,awrite=T,bwrite=T, oround=8) 
